package com.fhxy.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * ClassName: WebMvcConfig
 * date: 2024/6/14 10:07
 *
 * @author 卢洋
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

    @Override
    public void addCorsMappings(CorsRegistry registry) {
        //设置允许跨域请求的域名
        registry.addMapping("/**")
                .allowedOrigins("http://localhost:8080","http://127.0.0.1:9527","http://127.0.0.1:8080","http://127.0.0.1:8083")
                .allowCredentials(true)
                .allowedMethods("*")
                .maxAge(3600);

    }
}
